﻿
using Furion.EventBus;

using Microsoft.Extensions.Logging;

namespace testZdj.Application
{
    /// <summary>
    /// 订阅消息接收事件
    /// 此处如果继承ISingleton或者ITransient那么订阅事件会被触发两次
    /// </summary>
    public class MsgEventSubscriber : IEventSubscriber,ISingleton// ITransient//
    {

        
        private readonly ILogger<MsgEventSubscriber> _logger;
        public MsgEventSubscriber(ILogger<MsgEventSubscriber> logger)
        {
            _logger = logger;
        }

        [EventSubscribe("tt")]
        public async Task ReceiveMsg(EventHandlerExecutingContext context)
        {
            _logger.LogInformation(DateTime.Now.ToString());
            await Task.CompletedTask;
        }
    }
}
